package cn.example.office_auto_sys.common.rseult;

public class CommonResult<T> {
    private String code;
    private String message;
    private T date;

    public static <T> CommonResult<T> success() {
        return new CommonResult<T>(BusinessCode.SUCCESS.getCode(), BusinessCode.SUCCESS.getMassage());

    }
    public static <T> CommonResult<T> success(T data) {
        return new CommonResult<T>(BusinessCode.SUCCESS.getCode(), BusinessCode.SUCCESS.getMassage(), data);

    }

    public static <T> CommonResult<T> failed() {
        return new CommonResult<T>(BusinessCode.FAILED.getCode(), BusinessCode.FAILED.getMassage());

    }

    public static <T> CommonResult<T> failed(T data) {
        return new CommonResult<T>(BusinessCode.FAILED.getCode(), BusinessCode.FAILED.getMassage(), data);

    }

    public static <T> CommonResult<T> paramFailed(T data) {
        return new CommonResult<T>(BusinessCode.PARAM_VER_FAILED.getCode(), BusinessCode.PARAM_VER_FAILED.getMassage(), data);

    }

    public static <T> CommonResult<T> forbidden(T data) {
        return new CommonResult<T>(BusinessCode.FORBIDDEN.getCode(), BusinessCode.FORBIDDEN.getMassage(), data);

    }

    public CommonResult() {
    }

    public CommonResult(String code, String message) {
        this.code = code;
        this.message = message;
    }
    public CommonResult(String code, String message, T date) {
        this.code = code;
        this.message = message;
        this.date = date;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getDate() {
        return date;
    }

    public void setDate(T date) {
        this.date = date;
    }
}
